package com.clkj.sunhelp.adapter.list;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.clkj.sunhelp.R;
import com.clkj.sunhelp.bean.JobWaitToDoItem;

import java.util.List;

/**
 * Created by Administrator on 2017/3/28.
 */

public class ListAdapterForJobWaitToDo extends BaseAdapter {

    List<JobWaitToDoItem> mJobWaitToDoList;
    Context mContext;
    LayoutInflater mLayoutInflater;

    String mJobKindName;

    public ListAdapterForJobWaitToDo(String jobKindName ,List<JobWaitToDoItem> jobWaitToDoList, Context context) {

        this.mJobKindName = jobKindName;
        mJobWaitToDoList = jobWaitToDoList;
        mContext = context;
        mLayoutInflater = LayoutInflater.from(mContext);
    }

    @Override
    public int getCount() {
        return mJobWaitToDoList.size();
    }

    @Override
    public Object getItem(int position) {
        return mJobWaitToDoList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder = null;
        if (convertView == null)
        {
            convertView = mLayoutInflater.inflate(R.layout.list_item_job_wait_to_do,null);
            viewHolder = new ViewHolder();
            viewHolder.tvDeal = (TextView) convertView.findViewById(R.id.tv_deal);
            viewHolder.tvJobKindName = (TextView) convertView.findViewById(R.id.tv_job_kind_name);
            viewHolder.tvJobDealStepName = (TextView) convertView.findViewById(R.id.tv_job_deal_step_name);
            viewHolder.tvCreateManAndTime = (TextView) convertView.findViewById(R.id.tv_create_man_and_time);

            convertView.setTag(viewHolder);

        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.tvJobKindName.setText(mJobKindName);
        viewHolder.tvJobDealStepName.setText(mJobWaitToDoList.get(position).getActivityName());
        viewHolder.tvCreateManAndTime.setText("户主:"+mJobWaitToDoList.get(position).getHZName()+" "+mJobWaitToDoList.get(position).getCreateDate());

        /*viewHolder.tvDeal.setText(mPolicyList.get(i).getFullHead());
        viewHolder.tvJobKindNameAndIndex.setText(mPolicyList.get(i).getReleaseTime());
        viewHolder.tvJobDealStepName.setText(mPolicyList.get(i).getFullHead());
        viewHolder.tvNormalContent.setText(mPolicyList.get(i).getReleaseTime());*/

        return convertView;
    }


    static class ViewHolder{
        private TextView tvDeal;
        private TextView tvJobKindName;
        private TextView tvJobDealStepName;
        private TextView tvCreateManAndTime;





    }




}
